package model

type QueryStatement struct {
	SelectStatement *SelectStatement `json:"SelectStatement,omitempty"`
	InsertStatement *InsertStatement `json:"InsertStatement,omitempty"`
	UpdateStatement *UpdateStatement `json:"UpdateStatement,omitempty"`
	DeleteStatement *DeleteStatement `json:"DeleteStatement,omitempty"`
}

type InsertStatement struct {
	TableRef     *Expr
	Fields       []*Expr
	ValueRowList []*ValueRow // 这里支持多行
}

type ValueRow struct {
	Tuple []*Expr // 一行Row
}

type SelectStatement struct {
	ColumnNames []*Expr
	FromClause  *Expr
	WhereClause *Expr
}

type UpdateStatement struct {
	TableRef    *Expr
	AssignList  []AssignExpr
	WhereClause *Expr
}

type AssignExpr struct {
	Name  string
	Value *Expr
}

type DeleteStatement struct {
	TableRef    *Expr
	WhereClause *Expr
}

func NewSelectStatement() *SelectStatement {
	return &SelectStatement{
		WhereClause: nil,
		FromClause:  nil,
	}
}
